package com.ehome.poct.base.controller.device;

import com.ehome.poct.base.api.dto.device.BootInfoExportQry;
import com.ehome.poct.base.api.dto.device.bootModule.TestDeviceBootingDetailDTO;
import com.ehome.poct.base.api.virtual.device.TestDeviceBootingDetailService;
import com.ehome.poct.base.api.vo.device.BootDetailExportVO;
import com.ehome.poct.base.api.vo.device.TestDeviceBootingDetailVO;
import com.ehome.poct.base.controller.service.BootingInfoService;
import com.ehome.web.controller.AbstractBaseController;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * 开机自检记录详细控制器
 *
 * @author laobai
 * @Date 2022-10-17 10:11
 */
@Slf4j
@Api(tags = "开机自检记录详细")
@RestController
@AllArgsConstructor
@RequestMapping("/devicebootingdetail")
public class TestDeviceBootingDetailController extends AbstractBaseController<TestDeviceBootingDetailVO, TestDeviceBootingDetailDTO> {
    private final TestDeviceBootingDetailService deviceBootingDetailService;
    private final BootingInfoService bootingInfoService;

    /**
     * 查询开机自检记录详细
     *
     * @param reqDto 多个sno号码
     * @return 设备自检详细DATA
     */
    @ApiOperation("获取设备自检记录详细数据")
    @ApiOperationSupport(author = "laobai")
    @PostMapping("/exportdetaildata")
    public List<BootDetailExportVO> getBootingDetails(@RequestBody BootInfoExportQry reqDto) {
        return bootingInfoService.buildExportList(deviceBootingDetailService.getExportDetailData(reqDto));
    }

}
